<template>
  <div>
    <v-header v-if="!$root.ISAPP&&!insq">
      <div class="nav-tab2">
        <h3>{{buyerOrSell}}</h3>
      </div>
    </v-header>
    <div v-html="richtext" class="richtext"></div>
  </div>
</template>
<script>
import { mapGetters } from "vuex";
import { agreement } from "../../../common/api/snekc2c.js";
export default {
  data() {
    return {
      richtext: "",
      buyerOrSell: ""
    };
  },
  computed: {
    ...mapGetters({
      insq: "insq",
      userInfo: "userInfo"
    })
  },
  mounted() {
    let type = this.$route.query.type;
    // this.buyerOrSell =
    //   type == 1 ? "卖家须知" : type == 2 ? "交易须知" :  type == 3 ? "商家协议" : "保证金协议";
    switch (Number(type)) {
      case 1:
        this.buyerOrSell = "卖家须知";
        break;
      case 2:
        this.buyerOrSell = "交易须知";
        break;
      case 3:
        this.buyerOrSell = "商家协议";
        break;
      case 4:
        this.buyerOrSell = "保证金协议";
        break;
      case 5:
        this.buyerOrSell = "新手必看";
        break;
    }
   
    window.document.title = this.buyerOrSell;
    agreement({ type })
      .then(res => {
        if (res && res.agreement) {
          this.richtext = res.agreement.replace(/568/g, "");
          console.log("富文本数据", this.richtext);
        }
      })
      .catch(e => {
        console.error(e);
      });
   
  }
};
</script>
<style scoped>
p,
table,
tbody,
tr {
  width: 100% !important;
}
.richtext{
  padding: 10px;
}
</style>


